









package com.company.kjianzhaozhemoshi.section1;

import java.util.ArrayList;

/**
 * @author cbf4Life cbf4life@126.com
 * I'm glad to share my knowledge with you all.
 * ����һ������ģ�͵ĳ����࣬���еĳ���ģ�Ͷ��̳�������
 */
public abstract class CarModel {
	
	
	private ArrayList<String> sequence = new ArrayList<String>();
	
	/*
	 * ģ����������ʼ����
	 */
	protected abstract void start();
	
	
	protected abstract void stop();
	
	
	protected abstract void alarm();
	
	
	protected abstract void engineBoom();
	
	
	final public void run() {
		
		
		for(int i=0;i<this.sequence.size();i++){
			String actionName = this.sequence.get(i);
			
			if(actionName.equalsIgnoreCase("start")){  
				this.start();  
			}else if(actionName.equalsIgnoreCase("stop")){ 
				this.stop(); 
			}else if(actionName.equalsIgnoreCase("alarm")){ 
				this.alarm(); 
			}else if(actionName.equalsIgnoreCase("engine boom")){  
				this.engineBoom();  
			}
					
		}
		
	}
	
	
	final public void setSequence(ArrayList<String> sequence){
		this.sequence = sequence;
	}
}